package com.ea.report.pojo.po.vibraResult;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;

@Getter
@AllArgsConstructor
public enum VibraResultProperties {

    /**
     * Aggression (P7)	侵略性 -> 攻击性
     */
    Aggression("VI_VAR_STAT_RES_P7", 7L, 23L, null, 2),
    /**
     * Tension/Anxiety (F5X)	紧张/焦虑 -> 焦虑
     */
    Anxiety("VI_VAR_STAT_RES_F5X", 8L, 24L, null, 2),
    /**
     * Energy (P8)	精力 -> 活力
     */
    Energy("VI_VAR_STAT_RES_P8", 9L, 25L, null, 1),
    /**
     * Depression	抑郁值 -> 抑郁
     */
    Depression("VI_VAR_STAT_RES_P29", 10L, 26L, null, 2),
    /**
     * Inhibition (F6)	抑制力
     */
    Inhibition("VI_VAR_STAT_RES_F6", 11L, 27L, null, 3),
    /**
     * Stress (P6)	精神压力 -> 压力
     */
    Stress("VI_VAR_STAT_RES_P6", 12L, 28L, null, 2),
    /**
     * Balance (P16)	平衡性 -> 平衡
     */
    Balance("VI_VAR_STAT_RES_P16", 13L, 29L, null, 1),
    /**
     * Suspect (P19)	可疑度 -> 可疑
     */
    Suspect("VI_VAR_STAT_RES_P19", 14L, 30L, null, 2),
    /**
     * Charm (P17)	吸引力 -> 自信
     */
    Charm("VI_VAR_STAT_RES_P17", 15L, 31L, null, 1),
    /**
     * Self regulation (P18)	自我调节 -> 自我调节
     */
    SelfRegulation("VI_VAR_STAT_RES_P18", 16L, 32L, null, 1),
    /**
     * Neuroticism (F9)	情绪稳定性
     */
    Neuroticism("VI_VAR_STAT_RES_F9", 17L, 33L, null, 3),
    /**
     * Happiness	快乐值 -> 幸福
     */
    Happiness("VI_VAR_STAT_RES_P30", 18L, 34L, null, 1),

    /**
     * Extraversion (P26)	外向性
     */
    Extraversion("VI_VAR_STAT_RES_P26", null, null, "外向性", 0),
    /**
     * Stability (P27)	稳定性
     */
    Stability("VI_VAR_STAT_RES_P27", null, null, "稳定性", 0),

    // /**
    //  * Health (P21) 健康 普通肿瘤学的健康水平
    //  */
    // Health("VI_VAR_STAT_RES_P21", null, null, 0),
    // /**
    //  * Health? (P22) 健康 前列腺肿瘤学的健康水平
    //  */
    // Health2("VI_VAR_STAT_RES_P22", null, null, 0),
    // /**
    //  * ΣVi (P23)  	Health的平均值
    //  */
    // Health3("VI_VAR_STAT_RES_P23", null, null, 0),

    /**
     * 生理情绪
     */
    PhysiologicalEmotion(null, null, null, "生理情绪", 0),
    /**
     * 正面情绪
     */
    PositiveEmotion(null, null, null, "正面情绪", 0),
    /**
     * 负面情绪
     */
    NegativeEmotion(null, null, null, "负面情绪", 0),

    /**
     * 心理变化率
     */
    PsychologicalChangeRate(null, null, null, "心理变化率", 0),
    /**
     * 心理测试频谱图
     */
    PsychologicalTestSpectrum(null, null, null, "心理测试频谱图", 0),

    /**
     * 平均频率
     */
    AverageFrequency(null, null, null, "平均频率", 0),
    ;
    static final HashMap<Long, VibraResultProperties> idMap;

    final String id;
    final Long defaultCompanyConfId;
    final Long defaultCompanyConfIdOfValue;
    final String propertiesName;
    /**
     * 情绪类型 none 0 positive 1, negative 2, physiological 3
     * Conditionally positive emotions are Balance, Charm, Energy, Self-regulation (T5 – T8).
     * Conditionally negative emotions are Aggression, Stress, Tension, Suspect (T1 – T4). Conditionally
     * physiological emotions are Inhibition and Neuroticism (T9, T10).
     * In a row “Positive” (fig. 5. 1) there
     * are average value for parameters M and Vi for T1 – T4.
     * By analogy, values in rows “Negative” and
     * “Physiological” are calculating.
     */
    final Integer emotionType;
    static final HashMap<String, VibraResultProperties> map;

    static {
        HashMap<String, VibraResultProperties> hashMap = new HashMap<>(VibraResultProperties.values().length);
        for (VibraResultProperties value : VibraResultProperties.values()) {
            hashMap.put(value.getId(), value);
        }
        map = hashMap;

        HashMap<Long, VibraResultProperties> idHashMap = new HashMap<>(VibraResultProperties.values().length);
        for (VibraResultProperties value : VibraResultProperties.values()) {
            idHashMap.put(value.getDefaultCompanyConfId(), value);
        }
        idMap = idHashMap;
    }

    public static VibraResultProperties getPropertiesById(String title) {
        // 根据title获得defaultCompanyConfId
        return map.get(title);
    }

    public static VibraResultProperties getPropertiesByDefaultCompanyConfId(long defaultCompanyConfId) {
        return idMap.get(defaultCompanyConfId);
    }
}
